package org.batatasframework.chart.columns;

import org.batatasframework.chart.graphics.ChartGraphic;

public class ColumnValueOption extends AbstractValueColumn<int[]> implements ChartColumnValue{

	private final String[] options;
	private final int indexOf;

	public ColumnValueOption(String name, int indexOf, String...options) {
		super(name);
		this.indexOf = indexOf;
		this.options = options;
		this.rowspan = 2;
	}
	
	@Override
	protected int[] internalParseValue(Object[] row) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int size() {
		return options.length;
	}

//	@Override
//	public ChartColumnValue initialize(OrdinalAllocatable allocator) {
//		return this;
//	}

	@Override
	public ChartColumnValue graphic(ChartGraphic... graphics) {
		for(ChartGraphic graphic : graphics){
			graphic.add(this);
		}
		return this;
	}

	@Override
	public void resolveHead(String[] heads, int deep) {
		super.resolveHead(heads, deep);
		String head = heads[deep + 1];
		for(String opt : options){
			head += "<th>" + opt + "</th>";
		}
		heads[deep + 1] = head;
	}

//	@Override
//	public int getOrdinal() {
//		// TODO Auto-generated method stub
//		return 0;
//	}

	@Override
	public ChartColumnValue setUnit(String unit) {
		// TODO Auto-generated method stub
		return this;
	}
}
